{{indexmenu_n>4}}

====== Flatpak ======

{{:opencpn:manual_basic:get_started:installation:flatpak.png?60|}}

OpenCPN Version 5.6.2 is available as a Flatpak package. This packaging system is supported on all major Linux distributions. [[https://flathub.org/apps/details/org.opencpn.OpenCPN|Simplified Installation Instructions on flathub.org]]

--OR--
Manual Installation:

  - Install flatpak on your system as described in Quick Setup [[https://flatpak.org/setup/|flatpak.org/setup]]
  - Install OpenCPN Flatpak image using:

   $ flatpak install --user  https://flathub.org/repo/appstream/org.opencpn.OpenCPN.flatpakref

Start OpenCPN:

   $ flatpak run org.opencpn.OpenCPN

=== Summary ===

The opencpn flatpak build targets Linux users on distros includiing (but not limited to) Fedora, Arch, SuSE and non-LTS Ubuntu releases. It is also the supported way to install OpenCPN on RPi-4 and other high-end aarch64 system. Flatpak is also supported on Raspbian, it is only available for amd64/x86_64 and aarch64 hardware.

To install the Flatpak version of OpenCPN, first install flatpak as described in [[https://flatpak.org/setup/|https://flatpak.org/setup/]].  The initial installation is possibly huge, around 450Mb, This is a one-time setup download, later updates weighs in at about 50 Mb or less. 

The flatpak installation is integrated in the desktop. Using for example gnome the flatpak'ed opencpn can be started like any other application. It can also be started from the command line using:

=== Verifying installation ===

To verify the installation ''flatpak list'' can be used to get information below:
<code>
 $ flatpak list
Name                 Application ID                        Version         Branch Origin         Installation
Freedesktop Platform org.freedesktop.Platform              18.08.39        18.08  flathub        system
Intel                org.freedesktop.Platform.VAAPI.Intel                  18.08  flathub        system
html5-codecs         org.freedesktop.Platform.html5-codecs                 18.08  flathub        system
Freedesktop SDK      org.freedesktop.Sdk                   18.08.39        18.08  flathub        system
OpenCPN              org.opencpn.OpenCPN                   5.2.0-0 4d956e1 test   opencpn-origin user
</code>

Configuration files  like opencpn.log, opencpn.conf and installed plugins otherwise found at //~/.opencpn// exists in //~/.var/app/org.opencpn.OpenCPN/config/opencpn//

A regular OpenCPN  installation installed using apt and flatpak OpenCPN can be used side by side, the configurations are independent of each other.

=== Updating OpenCPN ===

To update the system to the latest version:

<code>
$ flatpak update org.opencpn.OpenCPN

</code>

The installed plugins and configuration are not affected by an uninstall and reinstall.

=== Configuring the USB dongle ===

If the USB dongle is not found try:

[[:opencpn:manual_basic:get_started:installation:flatpak:usb|]]

=== Flatpak Access to Directories  ===

Out of the box, the Flatpak package can access files in the home directory. As long as charts are installed here no actions needs to be taken. However, if charts needs to be stored outside of $HOME (for exampe on an USB stick) flatpak must be given access to the used directories using something like
<code>

  $ flatpak override --user org.opencpn.OpenCPN  --filesystem=/usr/local/charts

</code>

More information: [[https://docs.flatpak.org/en/latest/sandbox-permissions.html|https://docs.flatpak.org/en/latest/sandbox-permissions.html]]

=== Flatpak Access to Serial Devices ===

Out of the box, most Linux distribution restrict access to devices like ///dev/ttyUSB0// or ///dev/ttyS0//. This means that such devices are not visible in the Flatpak sandbox and thus invisible and unusable also in OpenCPN.

To fix this, create a file named like //70-serial-opencpn.rules// with contents like 

    KERNEL=="ttyUSB*", MODE="0666"
    KERNEL=="ttyACM*", MODE="0666"
    KERNEL=="ttyS*", MODE="0666"
    
Usually, only one line is required; for example when using ///dev/ttyUSB0// only the first line needs to exist. Copy the file to /etc/udev/rules.d/ using ''sudo cp 70-serial-opencpn.rules /etc/udev/rules.d/''. To activate rule run ''sudo udevadm control --reload-rules && sudo udevadm trigger''. Or just reboot. When active, the device in question will be visible in OpenCPN. 

The basic test is to check the permissions of the device which should be 666 (i. e., crw-rw-rw) when listed using for example ''ls -l /dev/ttyUSB0''

A related problem is that devices like /dev/ttyUSB0 can change name to /dev/ttyUSB1 after a suspend-resume cycle, for example when closing and re-opening a laptop lid. See the file [[https://github.com/OpenCPN/OpenCPN/blob/master/LINUX_DEVICES.md | LINUX_DEVICES.md]] for more info


